<?php

class CitiesService {

	var $citiesList = array();

	function CitiesService (){
		$citiesProperties = new Properties(PROPERTIES . 'cities-list.properties');
		$array = $citiesProperties->properties;
		$keyset = array_keys($array);
		for($i = 0; $i < count($keyset); $i++){
			$city = new City();
			$city->key = $keyset[$i];
			$city->name = $array[$city->key];
			$this->citiesList[$i] = $city;
		}
	}
	
	function get($key){
		$result = null;
		for($i = 0; $i < count($this->citiesList); $i++){
			if($this->citiesList[$i]->key == $key){
				$result = $this->citiesList[$i];
				break; 			
			}
		}		
		return $result;
	}
	
}




?>